package handler

import (
	"github.com/gin-gonic/gin"
	"red-book-manager/model"
	"strconv"
)

func List(c *gin.Context) {
	page, _ := strconv.Atoi(c.Query("page"))
	size, _ := strconv.Atoi(c.Query("size"))
	offset := (page - 1) * size
	var list []model.Img
	model.DB.Offset(offset).Limit(size).Debug().Find(&list)
	c.JSON(200, gin.H{
		"code": 200,
		"msg":  "OK",
		"data": list,
	})
	return
}
